/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.spakehelpdesk.java;

import com.spakehelpdesk.session.LoginSession;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author leehoanh
 */
public class EncryptionMd5 {
    public static String Encryption(String text) {
        String md5 = null;
        try {
            MessageDigest mdEnc = MessageDigest.getInstance("MD5");
            mdEnc.update(text.getBytes(), 0, text.length());
            md5 = new BigInteger(1, mdEnc.digest()).toString(16);

        } catch (NoSuchAlgorithmException ex) {
            Logger.getLogger(LoginSession.class.getName()).log(Level.SEVERE, null, ex);
        }
        return md5;
    }
    
}
